<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>
<form action="login.php" method="post">
	<input type="text" name="loginName" placeholder="用户名" /><br>
	<input type="password" name="password" placeholder="密码"><br>
	<input type="submit" value="登录" />
</form>
</body>
</html>
<?php

    header("Content-Type:text/html; charset=utf-8");
    //接收请求，处理请求，完成响应
    $username = $_POST["username"];
    $password = $_POST["password"];
    $loginName = $_POST["loginName"];

    //处理请求，往数据库里增加一条数据
    $con = mysqli_connect("127.0.0.1","root","","xxy");
    //判断是否已经建立链接
    if(!$con){
        printf("Can't connect to MySQL Server. Errorcode: %s ",mysqli_connect_error());
        exit;
    }

    $sql = "INSERT INTO employee(username,password,loginName) VALUES('$username','$password','$loginName')";

    //使用mysqli_query 函数 通过$con 连接 把$sql发送到数据库
    /*if(!mysqli_query($con,$sql)){
        die('Error: '.mysql_error());
    }*/
    mysqli_query($con,$sql);

    //注册成功，我们可以让它跳转到登录页面


    mysqli_close($con);
?>